Access Construct
The access construct can be added to a property or method declaration making the
access modifier dynamic. That is a method's or property's access modifier (whether it is private or public) can change depending on role of the
logged in user.
For example 'MyMethod' will be 'public' when the
logged in user has the
role 'MyRole'. When the logged in user does not have the role 'MyRole' then the method 'MyMethod' will be private.
Note:
The access modifier changes the run time appearance of the property or the method, not whether a property or method is public or private at compile time. This means that other code can still use a method or property. Only at run time, when the method or property is called, will access roles be checked against the login user roles.
public void MyMethod() :access(MyRole)
{
...
}
The access construct can also be used with properties.
public void MyProperty:access(MyRole)
{
get;
set;
}
In the this example the property can be set if
logged in user has the
role of "MyRole".
public void MyProperty
{
get;
set:access(MyRole);
}
Note:
The access construct can not be used to assign roles to a workflow object. Workflow objects must have roles assigned programmatically.The access construct can also use a boolean property as parameter. See
Basket Example (Controlling when a method can be called)